<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <title>添加类型</title>
</head>

<style>
    .button-width{
        width: 224px;
    }
</style>

<body>

<br>
<br>
<br>
<br>
<br>
<div class="container animated jackInTheBox lucency-xs">
    <div class="row">
        <div class="col-md-10 col-md-offset-2">
            <div class="panel panel-warning">
                <div class="panel-heading">
                    <h3>添加动态</h3>
                    <hr>
                </div>
                <div class="panel-body">
                    <form action="#" th:action="@{/dynamic/adddynamic}" method="post">
                        <div class="input-group">
                            <label>标题</label>
                            <input type="text" name="title" class="form-control border-radius-xxs" placeholder="请输入标题...">
                        </div>
                        <div class="input-group">
                            <br>
                            <label>首图</label>
                            <input type="text" name="picture" class="form-control border-radius-xxs" placeholder="请输入首图地址...">
                        </div>
                        <br>
                        <div class="input-group">
                            <label>内容</label>
                            <br>
                            <textarea cols="100" name="content" rows="10" placeholder="输入详细内容"></textarea>
                        </div>
                        <br>
                            <input type="submit" class="btn btn-success button-width" value="提交">
                            <a href="#" th:href="@{/dynamic/index}" class="btn btn-default button-width">返回</a>

                    </form>
                </div>
            </div>

        </div>
    </div>
</div>

<!--/*/<th:block th:replace="fragments :: script">/*/-->
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<!--加载bootstrap验证器-->
<script src="../static/bootstrap/js/bootstrapValidator.min.js" th:src="@{/bootstrap/js/bootstrapValidator.min.js}"></script>
<!--/*/</th:block>/*/-->

<script>
    $(function () {
        $('form').bootstrapValidator({

            message: '错误!!',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                title: {
                    validators: {
                        notEmpty: {
                            message: '标题不能为空'
                        }
                    }
                },
                picture: {
                    validators: {
                        notEmpty: {
                            message: '首图不能为空'
                        }
                    }
                },
                content: {
                    validators: {
                        notEmpty: {
                            message: '内容不能为空'
                        }
                    }
                }
            }
        });
    });
</script>
</body>
</html>